package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEquipmentServerApplyServerDetail;
import com.glsc.ngateway.common.base.domainmapper.FlowFormEquipmentServerApplyServerDetailMapper;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.equipment.domainDto.FlowFormEquipmentServerApplyServerDetailDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * FlowFormEquipmentServerApplyServerDetail转换器
 * @author xuchang
 */
public class FlowFormEquipmentServerApplyServerDetailConverter extends AbstractFlowFormDataConverter {
    public static FlowFormEquipmentServerApplyServerDetailDto do2Dto(FlowFormEquipmentServerApplyServerDetail apply) {
        if (Objects.isNull(apply)) {
            return null;
        }
        FlowFormEquipmentServerApplyServerDetailDto applyDto = FlowFormEquipmentServerApplyServerDetailMapper.INSTANCE.domain2dto(apply);
        return applyDto;
    }

    public static List<FlowFormEquipmentServerApplyServerDetailDto> do2Dto(List<FlowFormEquipmentServerApplyServerDetail> applyList) {
        return CollectionUtils.isEmpty(applyList) ? java.util.Collections.emptyList() : applyList.stream().map(FlowFormEquipmentServerApplyServerDetailConverter::do2Dto).collect(Collectors.toList());
    }

    public static FlowFormEquipmentServerApplyServerDetail dto2Do(FlowFormEquipmentServerApplyServerDetailDto applyDto) {
        if (Objects.isNull(applyDto)) {
            return null;
        }
        FlowFormEquipmentServerApplyServerDetail apply = FlowFormEquipmentServerApplyServerDetailMapper.INSTANCE.dto2domain(applyDto);
        return apply;
    }

    public static List<FlowFormEquipmentServerApplyServerDetail> dto2Do(List<FlowFormEquipmentServerApplyServerDetailDto> applyDtoList) {
        return CollectionUtils.isEmpty(applyDtoList) ? java.util.Collections.emptyList() : applyDtoList.stream().map(FlowFormEquipmentServerApplyServerDetailConverter::dto2Do).collect(Collectors.toList());
    }

}
